package edu_xy.hm_02.slice;

import edu_xy.hm_02.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.Text;
/*
    * 页面由两部分构成
    * 页面布局代码   xml
    * 后台逻辑代码   java

*/

public class MainAbilitySlice04 extends AbilitySlice {
    Text text_04_01=null;
    Text text_04_02=null;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        // 所关联的页面布局代码  xml
        super.setUIContent(ResourceTable.Layout_ability_main_04);
        Button button_04_01=(Button)this.findComponentById(ResourceTable.Id_button_04_01);
        Button button_04_02=(Button)this.findComponentById(ResourceTable.Id_button_04_02);
        text_04_01=(Text)this.findComponentById(ResourceTable.Id_text_04_01);
        text_04_02=(Text)this.findComponentById(ResourceTable.Id_text_04_02);

        button_04_01.setClickedListener(this::clickedListenerButton_04_01);
        button_04_02.setClickedListener(this::clickedListenerButton_04_02);

    }

    private void clickedListenerButton_04_01(Component component) {
        text_04_01.setText("登录按钮被单击");
    }
    private void clickedListenerButton_04_02(Component component) {
        text_04_02.setText("注册按钮被单击");
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
